/* eslint-disable */

import HTTP from './http'
import { delCookie } from '@/utils/utils'
// import { ACCESS_TOKEN } from '@/store/mutation-types'

export const requestInterceptor = function(config) {
  return config
}

export const requestInterceptorError = function(error) {
  return Promise.reject(error)
}

export const responseInterceptor = function(response) {
  const data = response.data || { code: undefined }
  const code = data.code
  const origin = window.location.origin
  const pageURL = window.location.href
  // if (code && code == HTTP.NOT_LOGIN) {
  //   window.location.href = origin + '/user/login' + '?redirect=' + encodeURIComponent(pageURL)
  //   delCookie(ACCESS_TOKEN)
  //   throw new Error(data.msg)
  // }
  // else if (code && code == HTTP.F`ORBIDDEN) {
  //   // alert('权限不足');
  //   // throw new Error(data.msg);
  // }
  return response
}
export const responseInterceptorError = function(error) {
  return Promise.reject(error)
}
